/* 基础样式重置 */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f8f9fa;
  width: 650px;
  min-height: 500px;
}

/* 容器布局 */
.container {
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

/* 头部样式 */
header {
  background: #fff;
  border-bottom: 1px solid #e9ecef;
  padding: 16px 20px 0;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
  text-align: center;
}

/* 标签页切换 */
.tabs {
  display: flex;
  border-bottom: 1px solid #e9ecef;
}

.tab-btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6c757d;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: #495057;
  background: #f8f9fa;
}

.tab-btn.active {
  color: #007bff;
  border-bottom-color: #007bff;
}

/* 主内容区域 */
main {
  flex: 1;
  overflow-y: auto;
}

.panel {
  display: none;
  padding: 20px;
}

.panel.active {
  display: block;
}

/* 保存面板样式 */
.save-options h2 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 12px;
}

.tab-count {
  color: #6c757d;
  margin-bottom: 20px;
  font-size: 13px;
}

.tab-count span {
  font-weight: 600;
  color: #007bff;
}

/* 保存模式选择 */
.save-mode {
  margin-bottom: 24px;
}

.save-mode h3 {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-option {
  display: block;
  cursor: pointer;
}

.radio-option input[type="radio"] {
  display: none;
}

.radio-content {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  transition: all 0.2s ease;
  background: #fff;
}

.radio-option:hover .radio-content {
  border-color: #007bff;
  background: #f8f9ff;
}

.radio-option input[type="radio"]:checked + .radio-content {
  border-color: #007bff;
  background: #f8f9ff;
}

.radio-icon {
  margin-right: 12px;
  color: #6c757d;
  flex-shrink: 0;
}

.radio-option input[type="radio"]:checked + .radio-content .radio-icon {
  color: #007bff;
}

.radio-text h4 {
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 2px;
}

.radio-text p {
  font-size: 12px;
  color: #6c757d;
  line-height: 1.4;
}

/* 工作区名称输入 */
.workspace-name {
  margin-bottom: 24px;
}

.workspace-name h3 {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

.workspace-name input {
  width: 100%;
  padding: 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.workspace-name input:focus {
  outline: none;
  border-color: #007bff;
}

.workspace-name input:invalid {
  border-color: #dc3545;
}

/* 按钮样式 */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  text-decoration: none;
  display: inline-block;
}

.btn.primary {
  background: #007bff;
  color: #fff;
}

.btn.primary:hover {
  background: #0056b3;
}

.btn.primary:disabled {
  background: #6c757d;
  cursor: not-allowed;
}

.btn.secondary {
  background: #6c757d;
  color: #fff;
}

.btn.secondary:hover {
  background: #545b62;
}

.btn.outline {
  background: transparent;
  color: #007bff;
  border: 2px solid #007bff;
}

.btn.outline:hover {
  background: #007bff;
  color: #fff;
}

.btn.danger {
  background: #dc3545;
  color: #fff;
}

.btn.danger:hover {
  background: #c82333;
}

#save-workspace {
  width: 100%;
}

/* 状态消息 */
.status-message {
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
  display: none;
}

.status-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* 工作区列表样式 */
.workspaces-list h2 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
}

/* 搜索栏 */
.search-bar {
  position: relative;
  margin-bottom: 16px;
}

.search-bar input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
}

.search-bar input:focus {
  outline: none;
  border-color: #007bff;
}

#search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #6c757d;
  cursor: pointer;
  padding: 4px;
}

#search-btn:hover {
  color: #007bff;
}

/* 工作区卡片 */
.workspace-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.workspace-card:hover {
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.workspace-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
  word-break: break-word;
}

.workspace-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #6c757d;
}

.workspace-meta .tabs-count {
  background: #e9ecef;
  color: #495057;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6c757d;
}

.empty-state svg {
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 4px;
}

.empty-state-sub {
  font-size: 12px;
  opacity: 0.8;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
}

.close-modal {
  background: none;
  border: none;
  font-size: 24px;
  color: #6c757d;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-modal:hover {
  color: #495057;
}

.modal-body {
  padding: 20px;
}

/* 工作区信息 */
.workspace-info {
  margin-bottom: 20px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
}

.workspace-info p {
  margin-bottom: 4px;
  font-size: 13px;
  color: #495057;
}

.workspace-info span {
  font-weight: 600;
}

/* 标签页列表 */
.tabs-list h3 {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
}

.tab-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fff;
}

.tab-favicon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.tab-info {
  flex: 1;
  min-width: 0;
}

.tab-title {
  font-size: 13px;
  font-weight: 500;
  color: #2c3e50;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-url {
  font-size: 11px;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-actions {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.tab-action-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #6c757d;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.tab-action-btn:hover {
  background: #f8f9fa;
  color: #495057;
}

.tab-action-btn.delete:hover {
  color: #dc3545;
}

/* 操作按钮组 */
.action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.action-buttons .btn {
  flex: 1;
  min-width: 120px;
}

/* 编辑表单 */
.edit-workspace-name {
  margin-bottom: 20px;
}

.edit-workspace-name label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 8px;
}

.edit-workspace-name input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
}

.edit-workspace-name input:focus {
  outline: none;
  border-color: #007bff;
}

/* 添加标签页表单 */
.add-tab {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e9ecef;
}

.add-tab h3 {
  font-size: 14px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 12px;
}

.add-tab-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-tab-form input {
  padding: 8px 12px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 13px;
}

.add-tab-form input:focus {
  outline: none;
  border-color: #007bff;
}

/* 确认删除样式 */
.warning {
  color: #dc3545;
  font-size: 13px;
  margin-top: 8px;
}

/* 页脚 */
footer {
  padding: 12px 20px;
  border-top: 1px solid #e9ecef;
  background: #f8f9fa;
  text-align: center;
}

footer p {
  font-size: 11px;
  color: #6c757d;
}

/* 响应式设计 */
@media (max-width: 480px) {
  body {
    width: 100vw;
  }
  
  .container {
    height: 100vh;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .action-buttons .btn {
    width: 100%;
  }
}

/* 滚动条样式 */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* 动画效果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.workspace-card {
  animation: fadeIn 0.3s ease;
}

.modal-content {
  animation: fadeIn 0.2s ease;
}

/* 加载状态 */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}